﻿using System;
using System.IO;
using System.IO.Compression;
using System.Collections.Generic;

using NBT.Info;
using NBT.Base;

namespace MC_TESTAPP_CLI
{
    public class Program
    {
        public static void Main(string[] args)
        {
            DateTime _beginTime = DateTime.Now;

            TagNodeListNamed _outTag = new TagNodeListNamed("Hello");

            _outTag.Add("BYTE", new TagNode(TagNodeType.TAG_BYTE, "BYTE", 10));
            _outTag.Add("INT", new TagNode(TagNodeType.TAG_INT, "INT", Int32.MaxValue));
            _outTag.Add("SHORT", new TagNode(TagNodeType.TAG_SHORT, "SHORT", Int16.MaxValue));
            _outTag.Add("LONG", new TagNode(TagNodeType.TAG_LONG, "LONG", Int64.MaxValue));

            TagNodeList _list = new TagNodeList("LIST", TagNodeType.TAG_INT);

            _list.Add(new TagNode(TagNodeType.TAG_INT, "", 1));
            _list.Add(new TagNode(TagNodeType.TAG_INT, "", 2));
            _list.Add(new TagNode(TagNodeType.TAG_INT, "", 3));
            _list.Add(new TagNode(TagNodeType.TAG_INT, "", 4));
            _list.Add(new TagNode(TagNodeType.TAG_INT, "", 5));

            _outTag.Add("LIST", _list);

            NBTWriter _nbtWrite = new NBTWriter(File.Create(@"C:\Users\blahblah\Desktop\fileOut.nbt"));

            _nbtWrite.BeginWrite(_outTag);

            _nbtWrite.Dispose();

            NBTReader _nbtRead = new NBTReader(File.Open(@"C:\Users\blahblah\Desktop\fileOut.nbt", FileMode.Open));

            TagNodeListNamed _contents = (TagNodeListNamed)_nbtRead.BeginRead();

            _nbtRead.Dispose();

            DateTime _endingTime = DateTime.Now;

            Console.Clear();

            Console.WriteLine("World parse complete!");

            Console.WriteLine("Total time taken: {0} seconds", Math.Round((_endingTime - _beginTime).TotalSeconds, 2));
        }
    }
}
